/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package grlu;

import Control.MovieControl;
import Control.PersonControl;
import Control.SongControl;
import Control.SoundTrackControl;
import DAO.exceptions.NonexistentEntityException;
import Entidad.*;
import java.awt.Color;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.UIManager;

/**
 *
 * @author USUARIO
 */
public class Main extends javax.swing.JFrame {
    private JFrame frame;
    public static EntityManagerFactory emf;
    public static EntityManager em;
    public static boolean inicioSesion;
    private PersonControl personControl;
    private MovieControl movieControl;
    private SoundTrackControl soundControl;
    private SongControl songControl;
    private Person persona;
    private Movie movie;
    private Song song;
    private SoundTrack sound;
    /**
     * Creates new form Main
     */
    public Main(boolean sesion) throws NonexistentEntityException {
        emf = Persistence.createEntityManagerFactory("GRLUPU", System.getProperties());
        em = emf.createEntityManager();
        personControl = new PersonControl();
        soundControl = new SoundTrackControl();
        movieControl = new MovieControl();
        songControl = new SongControl();
        initComponents();
        if(!sesion){
            tabbedPanelPrincipal.setEnabledAt(1, false);
            tabbedPanelPrincipal.setEnabledAt(2, false);
            tabbedPanelPrincipal.setEnabledAt(3, false);
            tabbedPanelPrincipal.setEnabledAt(4, false);
        }
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        txtLblBuscar = new javax.swing.JTextField();
        btnBuscar = new javax.swing.JButton();
        btnSalir = new javax.swing.JButton();
        btnAceptar = new javax.swing.JButton();
        comboBoxBusqueda = new javax.swing.JComboBox();
        tabbedPanelPrincipal = new javax.swing.JTabbedPane();
        findMoviesTab = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jLabel2 = new javax.swing.JLabel();
        btnSeeFindMovies = new javax.swing.JButton();
        btnCleanFindMovies = new javax.swing.JButton();
        personaTab = new javax.swing.JPanel();
        tabPanelPersona = new javax.swing.JTabbedPane();
        tabCreatePerson = new javax.swing.JPanel();
        lblNombreCreatePerson = new javax.swing.JLabel();
        lblLastNameCreatePerson = new javax.swing.JLabel();
        lblPictureCreatePerson = new javax.swing.JLabel();
        lblBirthDateCreatePerson = new javax.swing.JLabel();
        lblBirthPlaceCreatePerson = new javax.swing.JLabel();
        lblJobPerson = new javax.swing.JLabel();
        txtNameCreatePerson = new javax.swing.JTextField();
        txtLastNameCreatePerson = new javax.swing.JTextField();
        txtPictureCreatePerson = new javax.swing.JTextField();
        txtBirthPlaceCreatePerson = new javax.swing.JTextField();
        dateChooserBirth = new com.toedter.calendar.JDateChooser();
        btnCleanCreate = new javax.swing.JButton();
        btnCreateCreate = new javax.swing.JButton();
        comboBoxJobCreate = new javax.swing.JComboBox();
        tabDeletePerson = new javax.swing.JPanel();
        txtBuscarDeletePersona = new javax.swing.JTextField();
        btnBuscarDeletePersona = new javax.swing.JButton();
        scrollPanelTextArea = new javax.swing.JScrollPane();
        textAreaDeletePersona = new javax.swing.JTextArea();
        btnDeleteDeletePersona = new javax.swing.JButton();
        movieTab = new javax.swing.JPanel();
        tabPanelMovie = new javax.swing.JTabbedPane();
        tabCreateMovie = new javax.swing.JPanel();
        lblNameCreateMovie = new javax.swing.JLabel();
        lblYearCreateMovie = new javax.swing.JLabel();
        lblCoverCreateMovie = new javax.swing.JLabel();
        lblKeyWordsCreateMovie = new javax.swing.JLabel();
        lblGenreCreateMovie = new javax.swing.JLabel();
        lblDurationCreateMovie = new javax.swing.JLabel();
        lblRentalCreateMovie = new javax.swing.JLabel();
        lblPurchaseCreateMovie = new javax.swing.JLabel();
        txtNameCreateMovie = new javax.swing.JTextField();
        txtCoverCreateMovie = new javax.swing.JTextField();
        txtKeyWordsCreateMovie = new javax.swing.JTextField();
        txtGenreCreateMovie = new javax.swing.JTextField();
        txtDurationCreateMovie = new javax.swing.JTextField();
        btnCleanCreateMovie = new javax.swing.JButton();
        btnCreateCreateMovie = new javax.swing.JButton();
        rentalCheckBox = new javax.swing.JCheckBox();
        purchaseCheckBox = new javax.swing.JCheckBox();
        lblDirectorCreateMovie = new javax.swing.JLabel();
        txtDirectorCreateMovie = new javax.swing.JTextField();
        btnActorsCreateMovie = new javax.swing.JButton();
        lblActosrCreateMovie = new javax.swing.JLabel();
        lblSoundTrackCreateMovie = new javax.swing.JLabel();
        txtSoundTrackCreateMovie = new javax.swing.JTextField();
        lblRatingCreateMovie = new javax.swing.JLabel();
        jSliderRatingCreateMovie = new javax.swing.JSlider();
        jYearChooserMovie = new com.toedter.calendar.JYearChooser();
        tabDeleteMovie = new javax.swing.JPanel();
        txtBuscarDeleteMovie = new javax.swing.JTextField();
        btnBuscarDeleteMovie = new javax.swing.JButton();
        scrollPanelTextAreaMovie = new javax.swing.JScrollPane();
        textAreaDeleteMovie = new javax.swing.JTextArea();
        btnEliminarDeleteMovie = new javax.swing.JButton();
        songTab = new javax.swing.JPanel();
        tabPanelSong = new javax.swing.JTabbedPane();
        tabCreateSong = new javax.swing.JPanel();
        lblTitleCreateSong = new javax.swing.JLabel();
        lblDurationCreateSong = new javax.swing.JLabel();
        lblArtistCreateSong = new javax.swing.JLabel();
        txtTitleCreateSong = new javax.swing.JTextField();
        txtDurationCreateSong = new javax.swing.JTextField();
        txtArtistCreateSong = new javax.swing.JTextField();
        btnCleanCreateSong = new javax.swing.JButton();
        btnCreateCreateSong = new javax.swing.JButton();
        tabDeleteSong = new javax.swing.JPanel();
        txtBuscarDeleteSong = new javax.swing.JTextField();
        btnBuscarDeleteSong = new javax.swing.JButton();
        scrollPanelTextAreaMovie1 = new javax.swing.JScrollPane();
        textAreaDeleteSong = new javax.swing.JTextArea();
        btnEliminarDeleteSong = new javax.swing.JButton();
        soundTrackTab = new javax.swing.JPanel();
        tabPanelSoundTrack = new javax.swing.JTabbedPane();
        tabCreateSoundTrack = new javax.swing.JPanel();
        lblPictureCreateSoundTrack = new javax.swing.JLabel();
        lblSongosCreateSoundTrack = new javax.swing.JLabel();
        txtPictureCreateSoundTrack = new javax.swing.JTextField();
        btnCleanCreateSoundTrack = new javax.swing.JButton();
        btnCreateCreateSoundTrack = new javax.swing.JButton();
        btnSongsCreateSoundTrack = new javax.swing.JButton();
        tabDeleteSoundTrack = new javax.swing.JPanel();
        txtBuscarDeleteSoundTrack = new javax.swing.JTextField();
        btnBuscarDeleteSoundTrack = new javax.swing.JButton();
        scrollPanelTextAreaSoundTrack = new javax.swing.JScrollPane();
        textAreaDeleteMovie2 = new javax.swing.JTextArea();
        btnDeleteDeleteSoundTrack = new javax.swing.JButton();
        lblFindBy = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        txtLblBuscar.setForeground(new java.awt.Color(153, 153, 153));
        txtLblBuscar.setText("Find Movies.");
        txtLblBuscar.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                txtLblBuscarMouseClicked(evt);
            }
        });

        btnBuscar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/grlu/lupa.gif"))); // NOI18N
        btnBuscar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnBuscarActionPerformed(evt);
            }
        });

        btnSalir.setText("Close");
        btnSalir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnSalirActionPerformed(evt);
            }
        });

        btnAceptar.setText("Accept");

        comboBoxBusqueda.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Actor", "Artist", "Director", "Name" }));

        jLabel2.setText("Resultados de la busqueda:");

        btnSeeFindMovies.setText("See");
        btnSeeFindMovies.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnSeeFindMoviesActionPerformed(evt);
            }
        });

        btnCleanFindMovies.setText("Clean");
        btnCleanFindMovies.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCleanFindMoviesActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout findMoviesTabLayout = new javax.swing.GroupLayout(findMoviesTab);
        findMoviesTab.setLayout(findMoviesTabLayout);
        findMoviesTabLayout.setHorizontalGroup(
            findMoviesTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(findMoviesTabLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(findMoviesTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane1)
                    .addGroup(findMoviesTabLayout.createSequentialGroup()
                        .addComponent(jLabel2)
                        .addGap(0, 0, Short.MAX_VALUE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, findMoviesTabLayout.createSequentialGroup()
                        .addGap(0, 485, Short.MAX_VALUE)
                        .addComponent(btnCleanFindMovies, javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(btnSeeFindMovies, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );
        findMoviesTabLayout.setVerticalGroup(
            findMoviesTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, findMoviesTabLayout.createSequentialGroup()
                .addContainerGap(19, Short.MAX_VALUE)
                .addComponent(jLabel2)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 226, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(findMoviesTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnSeeFindMovies)
                    .addComponent(btnCleanFindMovies))
                .addGap(20, 20, 20))
        );

        tabbedPanelPrincipal.addTab("Find Movies", findMoviesTab);

        lblNombreCreatePerson.setText("Name: ");

        lblLastNameCreatePerson.setText("Last Name: ");

        lblPictureCreatePerson.setText("Picture: ");

        lblBirthDateCreatePerson.setText("Birth Date: ");

        lblBirthPlaceCreatePerson.setText("Birth Place: ");

        lblJobPerson.setText("Job: ");

        btnCleanCreate.setText("Clean");
        btnCleanCreate.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCleanCreateActionPerformed(evt);
            }
        });

        btnCreateCreate.setText("Create");
        btnCreateCreate.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCreateCreateActionPerformed(evt);
            }
        });

        comboBoxJobCreate.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Actor", "Artist", "Director" }));

        javax.swing.GroupLayout tabCreatePersonLayout = new javax.swing.GroupLayout(tabCreatePerson);
        tabCreatePerson.setLayout(tabCreatePersonLayout);
        tabCreatePersonLayout.setHorizontalGroup(
            tabCreatePersonLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(tabCreatePersonLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(tabCreatePersonLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(tabCreatePersonLayout.createSequentialGroup()
                        .addComponent(lblLastNameCreatePerson)
                        .addGap(33, 33, 33)
                        .addComponent(txtLastNameCreatePerson, javax.swing.GroupLayout.PREFERRED_SIZE, 171, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap(393, Short.MAX_VALUE))
                    .addGroup(tabCreatePersonLayout.createSequentialGroup()
                        .addGroup(tabCreatePersonLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(lblNombreCreatePerson)
                            .addComponent(lblPictureCreatePerson)
                            .addComponent(lblBirthDateCreatePerson)
                            .addComponent(lblBirthPlaceCreatePerson)
                            .addComponent(lblJobPerson))
                        .addGap(33, 33, 33)
                        .addGroup(tabCreatePersonLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(txtNameCreatePerson, javax.swing.GroupLayout.PREFERRED_SIZE, 170, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(txtPictureCreatePerson, javax.swing.GroupLayout.PREFERRED_SIZE, 171, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(txtBirthPlaceCreatePerson, javax.swing.GroupLayout.PREFERRED_SIZE, 171, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(dateChooserBirth, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(comboBoxJobCreate, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGroup(tabCreatePersonLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(btnCreateCreate, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 147, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(btnCleanCreate, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 147, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(41, 41, 41))))
        );
        tabCreatePersonLayout.setVerticalGroup(
            tabCreatePersonLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(tabCreatePersonLayout.createSequentialGroup()
                .addContainerGap(51, Short.MAX_VALUE)
                .addGroup(tabCreatePersonLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblNombreCreatePerson)
                    .addComponent(txtNameCreatePerson, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(tabCreatePersonLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblLastNameCreatePerson)
                    .addComponent(txtLastNameCreatePerson, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(tabCreatePersonLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblPictureCreatePerson)
                    .addComponent(txtPictureCreatePerson, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(tabCreatePersonLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(tabCreatePersonLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addComponent(lblBirthDateCreatePerson)
                        .addComponent(dateChooserBirth, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(btnCleanCreate))
                .addGap(10, 10, 10)
                .addGroup(tabCreatePersonLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblBirthPlaceCreatePerson)
                    .addComponent(txtBirthPlaceCreatePerson, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btnCreateCreate))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(tabCreatePersonLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(comboBoxJobCreate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblJobPerson))
                .addGap(43, 43, 43))
        );

        tabPanelPersona.addTab("Create", tabCreatePerson);

        txtBuscarDeletePersona.setForeground(new java.awt.Color(153, 153, 153));
        txtBuscarDeletePersona.setText("Name.");
        txtBuscarDeletePersona.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                txtBuscarDeletePersonaMouseClicked(evt);
            }
        });

        btnBuscarDeletePersona.setIcon(new javax.swing.ImageIcon(getClass().getResource("/grlu/lupa.gif"))); // NOI18N
        btnBuscarDeletePersona.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnBuscarDeletePersonaActionPerformed(evt);
            }
        });

        textAreaDeletePersona.setColumns(20);
        textAreaDeletePersona.setRows(5);
        scrollPanelTextArea.setViewportView(textAreaDeletePersona);

        btnDeleteDeletePersona.setText("Delete");
        btnDeleteDeletePersona.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnDeleteDeletePersonaActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout tabDeletePersonLayout = new javax.swing.GroupLayout(tabDeletePerson);
        tabDeletePerson.setLayout(tabDeletePersonLayout);
        tabDeletePersonLayout.setHorizontalGroup(
            tabDeletePersonLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(tabDeletePersonLayout.createSequentialGroup()
                .addGroup(tabDeletePersonLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(tabDeletePersonLayout.createSequentialGroup()
                        .addGap(22, 22, 22)
                        .addComponent(txtBuscarDeletePersona, javax.swing.GroupLayout.PREFERRED_SIZE, 131, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(btnBuscarDeletePersona, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(tabDeletePersonLayout.createSequentialGroup()
                        .addGap(20, 20, 20)
                        .addComponent(scrollPanelTextArea, javax.swing.GroupLayout.PREFERRED_SIZE, 368, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(47, 47, 47)
                        .addComponent(btnDeleteDeletePersona, javax.swing.GroupLayout.PREFERRED_SIZE, 107, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(122, Short.MAX_VALUE))
        );
        tabDeletePersonLayout.setVerticalGroup(
            tabDeletePersonLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, tabDeletePersonLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(tabDeletePersonLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(tabDeletePersonLayout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addComponent(btnDeleteDeletePersona))
                    .addGroup(tabDeletePersonLayout.createSequentialGroup()
                        .addGroup(tabDeletePersonLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(txtBuscarDeletePersona)
                            .addComponent(btnBuscarDeletePersona, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(scrollPanelTextArea, javax.swing.GroupLayout.DEFAULT_SIZE, 216, Short.MAX_VALUE)))
                .addContainerGap())
        );

        tabPanelPersona.addTab("Delete", tabDeletePerson);

        javax.swing.GroupLayout personaTabLayout = new javax.swing.GroupLayout(personaTab);
        personaTab.setLayout(personaTabLayout);
        personaTabLayout.setHorizontalGroup(
            personaTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, personaTabLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(tabPanelPersona)
                .addContainerGap())
        );
        personaTabLayout.setVerticalGroup(
            personaTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(personaTabLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(tabPanelPersona)
                .addContainerGap())
        );

        tabbedPanelPrincipal.addTab("Person", personaTab);

        lblNameCreateMovie.setText("Name: ");

        lblYearCreateMovie.setText("Year: ");

        lblCoverCreateMovie.setText("Cover:");

        lblKeyWordsCreateMovie.setText("Key Words:");

        lblGenreCreateMovie.setText("Genre:");

        lblDurationCreateMovie.setText("Duration:");

        lblRentalCreateMovie.setText("Avaible For Rental: ");

        lblPurchaseCreateMovie.setText("Avaible For Purchase: ");

        btnCleanCreateMovie.setText("Clean");
        btnCleanCreateMovie.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCleanCreateMovieActionPerformed(evt);
            }
        });

        btnCreateCreateMovie.setText("Create");
        btnCreateCreateMovie.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCreateCreateMovieActionPerformed(evt);
            }
        });

        lblDirectorCreateMovie.setText("Director: ");

        btnActorsCreateMovie.setIcon(new javax.swing.ImageIcon(getClass().getResource("/grlu/lupa.png"))); // NOI18N
        btnActorsCreateMovie.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnActorsCreateMovieActionPerformed(evt);
            }
        });

        lblActosrCreateMovie.setText("Actors:");

        lblSoundTrackCreateMovie.setText("Sound Track: ");

        lblRatingCreateMovie.setText("Rating: ");

        jSliderRatingCreateMovie.setMaximum(20);
        jSliderRatingCreateMovie.setToolTipText("");
        jSliderRatingCreateMovie.setValue(0);

        javax.swing.GroupLayout tabCreateMovieLayout = new javax.swing.GroupLayout(tabCreateMovie);
        tabCreateMovie.setLayout(tabCreateMovieLayout);
        tabCreateMovieLayout.setHorizontalGroup(
            tabCreateMovieLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(tabCreateMovieLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(tabCreateMovieLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(tabCreateMovieLayout.createSequentialGroup()
                        .addComponent(lblPurchaseCreateMovie)
                        .addGap(18, 18, 18)
                        .addComponent(purchaseCheckBox)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 295, Short.MAX_VALUE)
                        .addGroup(tabCreateMovieLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(btnCleanCreateMovie, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 147, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(btnCreateCreateMovie, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 147, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(65, 65, 65))
                    .addGroup(tabCreateMovieLayout.createSequentialGroup()
                        .addGroup(tabCreateMovieLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addComponent(lblYearCreateMovie, javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(tabCreateMovieLayout.createSequentialGroup()
                                .addComponent(lblKeyWordsCreateMovie)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(txtKeyWordsCreateMovie, javax.swing.GroupLayout.PREFERRED_SIZE, 171, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(tabCreateMovieLayout.createSequentialGroup()
                                .addGroup(tabCreateMovieLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(lblNameCreateMovie)
                                    .addComponent(lblCoverCreateMovie, javax.swing.GroupLayout.Alignment.LEADING))
                                .addGroup(tabCreateMovieLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, tabCreateMovieLayout.createSequentialGroup()
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addComponent(txtNameCreateMovie, javax.swing.GroupLayout.PREFERRED_SIZE, 170, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addGroup(tabCreateMovieLayout.createSequentialGroup()
                                        .addGap(71, 71, 71)
                                        .addGroup(tabCreateMovieLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(jYearChooserMovie, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(txtCoverCreateMovie, javax.swing.GroupLayout.PREFERRED_SIZE, 171, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, tabCreateMovieLayout.createSequentialGroup()
                                .addComponent(lblGenreCreateMovie)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(txtGenreCreateMovie, javax.swing.GroupLayout.PREFERRED_SIZE, 171, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, tabCreateMovieLayout.createSequentialGroup()
                                .addGroup(tabCreateMovieLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(lblDurationCreateMovie)
                                    .addComponent(lblRentalCreateMovie))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addGroup(tabCreateMovieLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(txtDurationCreateMovie, javax.swing.GroupLayout.PREFERRED_SIZE, 171, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGroup(tabCreateMovieLayout.createSequentialGroup()
                                        .addGap(21, 21, 21)
                                        .addComponent(rentalCheckBox)))))
                        .addGroup(tabCreateMovieLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(tabCreateMovieLayout.createSequentialGroup()
                                .addGap(59, 59, 59)
                                .addGroup(tabCreateMovieLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addGroup(tabCreateMovieLayout.createSequentialGroup()
                                        .addGroup(tabCreateMovieLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(lblDirectorCreateMovie)
                                            .addComponent(lblActosrCreateMovie))
                                        .addGroup(tabCreateMovieLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addGroup(tabCreateMovieLayout.createSequentialGroup()
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                                .addComponent(txtDirectorCreateMovie, javax.swing.GroupLayout.PREFERRED_SIZE, 170, javax.swing.GroupLayout.PREFERRED_SIZE))
                                            .addGroup(tabCreateMovieLayout.createSequentialGroup()
                                                .addGap(39, 39, 39)
                                                .addComponent(btnActorsCreateMovie, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addGap(0, 0, Short.MAX_VALUE))))
                                    .addGroup(tabCreateMovieLayout.createSequentialGroup()
                                        .addComponent(lblSoundTrackCreateMovie)
                                        .addGap(18, 18, 18)
                                        .addComponent(txtSoundTrackCreateMovie, javax.swing.GroupLayout.PREFERRED_SIZE, 170, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addComponent(lblRatingCreateMovie))
                                .addContainerGap())
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, tabCreateMovieLayout.createSequentialGroup()
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(jSliderRatingCreateMovie, javax.swing.GroupLayout.PREFERRED_SIZE, 172, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(63, 63, 63))))))
        );
        tabCreateMovieLayout.setVerticalGroup(
            tabCreateMovieLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(tabCreateMovieLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(tabCreateMovieLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblNameCreateMovie)
                    .addComponent(txtNameCreateMovie, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblDirectorCreateMovie)
                    .addComponent(txtDirectorCreateMovie, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(tabCreateMovieLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(tabCreateMovieLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(lblYearCreateMovie)
                        .addComponent(lblActosrCreateMovie))
                    .addComponent(btnActorsCreateMovie, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jYearChooserMovie, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(tabCreateMovieLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtCoverCreateMovie, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblCoverCreateMovie)
                    .addComponent(lblSoundTrackCreateMovie)
                    .addComponent(txtSoundTrackCreateMovie, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(tabCreateMovieLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(tabCreateMovieLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(lblKeyWordsCreateMovie)
                        .addComponent(txtKeyWordsCreateMovie, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(lblRatingCreateMovie))
                    .addComponent(jSliderRatingCreateMovie, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 20, Short.MAX_VALUE)
                .addGroup(tabCreateMovieLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, tabCreateMovieLayout.createSequentialGroup()
                        .addGroup(tabCreateMovieLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(lblGenreCreateMovie)
                            .addComponent(txtGenreCreateMovie, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(13, 13, 13)
                        .addGroup(tabCreateMovieLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(lblDurationCreateMovie)
                            .addComponent(txtDurationCreateMovie, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(tabCreateMovieLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(lblRentalCreateMovie)
                            .addComponent(rentalCheckBox))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(tabCreateMovieLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(lblPurchaseCreateMovie)
                            .addComponent(purchaseCheckBox))
                        .addGap(11, 11, 11))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, tabCreateMovieLayout.createSequentialGroup()
                        .addComponent(btnCleanCreateMovie)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(btnCreateCreateMovie)
                        .addGap(53, 53, 53))))
        );

        tabPanelMovie.addTab("Create", tabCreateMovie);

        txtBuscarDeleteMovie.setForeground(new java.awt.Color(153, 153, 153));
        txtBuscarDeleteMovie.setText("Title.");

        btnBuscarDeleteMovie.setIcon(new javax.swing.ImageIcon(getClass().getResource("/grlu/lupa.gif"))); // NOI18N
        btnBuscarDeleteMovie.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnBuscarDeleteMovieActionPerformed(evt);
            }
        });

        textAreaDeleteMovie.setColumns(20);
        textAreaDeleteMovie.setRows(5);
        scrollPanelTextAreaMovie.setViewportView(textAreaDeleteMovie);

        btnEliminarDeleteMovie.setText("Delete");
        btnEliminarDeleteMovie.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnEliminarDeleteMovieActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout tabDeleteMovieLayout = new javax.swing.GroupLayout(tabDeleteMovie);
        tabDeleteMovie.setLayout(tabDeleteMovieLayout);
        tabDeleteMovieLayout.setHorizontalGroup(
            tabDeleteMovieLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(tabDeleteMovieLayout.createSequentialGroup()
                .addGroup(tabDeleteMovieLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(tabDeleteMovieLayout.createSequentialGroup()
                        .addGap(22, 22, 22)
                        .addComponent(txtBuscarDeleteMovie, javax.swing.GroupLayout.PREFERRED_SIZE, 131, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(btnBuscarDeleteMovie, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(tabDeleteMovieLayout.createSequentialGroup()
                        .addGap(20, 20, 20)
                        .addComponent(scrollPanelTextAreaMovie, javax.swing.GroupLayout.PREFERRED_SIZE, 368, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(47, 47, 47)
                        .addComponent(btnEliminarDeleteMovie, javax.swing.GroupLayout.PREFERRED_SIZE, 107, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(122, Short.MAX_VALUE))
        );
        tabDeleteMovieLayout.setVerticalGroup(
            tabDeleteMovieLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, tabDeleteMovieLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(tabDeleteMovieLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(tabDeleteMovieLayout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addComponent(btnEliminarDeleteMovie))
                    .addGroup(tabDeleteMovieLayout.createSequentialGroup()
                        .addGroup(tabDeleteMovieLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(txtBuscarDeleteMovie)
                            .addComponent(btnBuscarDeleteMovie, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(scrollPanelTextAreaMovie, javax.swing.GroupLayout.DEFAULT_SIZE, 220, Short.MAX_VALUE)))
                .addContainerGap())
        );

        tabPanelMovie.addTab("Delete", tabDeleteMovie);

        javax.swing.GroupLayout movieTabLayout = new javax.swing.GroupLayout(movieTab);
        movieTab.setLayout(movieTabLayout);
        movieTabLayout.setHorizontalGroup(
            movieTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, movieTabLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(tabPanelMovie)
                .addContainerGap())
        );
        movieTabLayout.setVerticalGroup(
            movieTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, movieTabLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(tabPanelMovie, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        tabbedPanelPrincipal.addTab("Movie", movieTab);

        lblTitleCreateSong.setText("Title:");

        lblDurationCreateSong.setText("Duration:");

        lblArtistCreateSong.setText("Artists Name:");

        btnCleanCreateSong.setText("Clean");
        btnCleanCreateSong.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCleanCreateSongActionPerformed(evt);
            }
        });

        btnCreateCreateSong.setText("Create");
        btnCreateCreateSong.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCreateCreateSongActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout tabCreateSongLayout = new javax.swing.GroupLayout(tabCreateSong);
        tabCreateSong.setLayout(tabCreateSongLayout);
        tabCreateSongLayout.setHorizontalGroup(
            tabCreateSongLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(tabCreateSongLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(tabCreateSongLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(tabCreateSongLayout.createSequentialGroup()
                        .addComponent(lblArtistCreateSong)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 40, Short.MAX_VALUE)
                        .addComponent(txtArtistCreateSong, javax.swing.GroupLayout.PREFERRED_SIZE, 171, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(tabCreateSongLayout.createSequentialGroup()
                        .addComponent(lblDurationCreateSong)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(txtDurationCreateSong, javax.swing.GroupLayout.PREFERRED_SIZE, 171, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(tabCreateSongLayout.createSequentialGroup()
                        .addComponent(lblTitleCreateSong)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(txtTitleCreateSong, javax.swing.GroupLayout.PREFERRED_SIZE, 171, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 166, Short.MAX_VALUE)
                .addGroup(tabCreateSongLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(btnCleanCreateSong, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 147, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btnCreateCreateSong, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 147, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(65, 65, 65))
        );
        tabCreateSongLayout.setVerticalGroup(
            tabCreateSongLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(tabCreateSongLayout.createSequentialGroup()
                .addGap(37, 37, 37)
                .addGroup(tabCreateSongLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblTitleCreateSong)
                    .addComponent(txtTitleCreateSong, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btnCleanCreateSong))
                .addGap(18, 18, 18)
                .addGroup(tabCreateSongLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblDurationCreateSong)
                    .addComponent(txtDurationCreateSong, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btnCreateCreateSong))
                .addGap(18, 18, 18)
                .addGroup(tabCreateSongLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblArtistCreateSong)
                    .addComponent(txtArtistCreateSong, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(134, Short.MAX_VALUE))
        );

        tabPanelSong.addTab("Create", tabCreateSong);

        txtBuscarDeleteSong.setForeground(new java.awt.Color(153, 153, 153));
        txtBuscarDeleteSong.setText("Title.");

        btnBuscarDeleteSong.setIcon(new javax.swing.ImageIcon(getClass().getResource("/grlu/lupa.gif"))); // NOI18N
        btnBuscarDeleteSong.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnBuscarDeleteSongActionPerformed(evt);
            }
        });

        textAreaDeleteSong.setColumns(20);
        textAreaDeleteSong.setRows(5);
        scrollPanelTextAreaMovie1.setViewportView(textAreaDeleteSong);

        btnEliminarDeleteSong.setText("Delete");
        btnEliminarDeleteSong.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnEliminarDeleteSongActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout tabDeleteSongLayout = new javax.swing.GroupLayout(tabDeleteSong);
        tabDeleteSong.setLayout(tabDeleteSongLayout);
        tabDeleteSongLayout.setHorizontalGroup(
            tabDeleteSongLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(tabDeleteSongLayout.createSequentialGroup()
                .addGroup(tabDeleteSongLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(tabDeleteSongLayout.createSequentialGroup()
                        .addGap(22, 22, 22)
                        .addComponent(txtBuscarDeleteSong, javax.swing.GroupLayout.PREFERRED_SIZE, 131, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(btnBuscarDeleteSong, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(tabDeleteSongLayout.createSequentialGroup()
                        .addGap(20, 20, 20)
                        .addComponent(scrollPanelTextAreaMovie1, javax.swing.GroupLayout.PREFERRED_SIZE, 368, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(46, 46, 46)
                        .addComponent(btnEliminarDeleteSong, javax.swing.GroupLayout.PREFERRED_SIZE, 107, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(123, Short.MAX_VALUE))
        );
        tabDeleteSongLayout.setVerticalGroup(
            tabDeleteSongLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, tabDeleteSongLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(tabDeleteSongLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(tabDeleteSongLayout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addComponent(btnEliminarDeleteSong))
                    .addGroup(tabDeleteSongLayout.createSequentialGroup()
                        .addGroup(tabDeleteSongLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(txtBuscarDeleteSong)
                            .addComponent(btnBuscarDeleteSong, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(scrollPanelTextAreaMovie1, javax.swing.GroupLayout.DEFAULT_SIZE, 220, Short.MAX_VALUE)))
                .addContainerGap())
        );

        tabPanelSong.addTab("Delete", tabDeleteSong);

        javax.swing.GroupLayout songTabLayout = new javax.swing.GroupLayout(songTab);
        songTab.setLayout(songTabLayout);
        songTabLayout.setHorizontalGroup(
            songTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, songTabLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(tabPanelSong)
                .addContainerGap())
        );
        songTabLayout.setVerticalGroup(
            songTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, songTabLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(tabPanelSong, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        tabbedPanelPrincipal.addTab("Song", songTab);

        lblPictureCreateSoundTrack.setText("Picture:");

        lblSongosCreateSoundTrack.setText("Songs:");

        btnCleanCreateSoundTrack.setText("Clean");
        btnCleanCreateSoundTrack.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCleanCreateSoundTrackActionPerformed(evt);
            }
        });

        btnCreateCreateSoundTrack.setText("Create");
        btnCreateCreateSoundTrack.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCreateCreateSoundTrackActionPerformed(evt);
            }
        });

        btnSongsCreateSoundTrack.setIcon(new javax.swing.ImageIcon(getClass().getResource("/grlu/lupa.png"))); // NOI18N
        btnSongsCreateSoundTrack.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnSongsCreateSoundTrackActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout tabCreateSoundTrackLayout = new javax.swing.GroupLayout(tabCreateSoundTrack);
        tabCreateSoundTrack.setLayout(tabCreateSoundTrackLayout);
        tabCreateSoundTrackLayout.setHorizontalGroup(
            tabCreateSoundTrackLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(tabCreateSoundTrackLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(tabCreateSoundTrackLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lblPictureCreateSoundTrack)
                    .addComponent(lblSongosCreateSoundTrack))
                .addGap(68, 68, 68)
                .addGroup(tabCreateSoundTrackLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(btnSongsCreateSoundTrack, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtPictureCreateSoundTrack, javax.swing.GroupLayout.PREFERRED_SIZE, 171, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 166, Short.MAX_VALUE)
                .addGroup(tabCreateSoundTrackLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(btnCleanCreateSoundTrack, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 147, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btnCreateCreateSoundTrack, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 147, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(65, 65, 65))
        );
        tabCreateSoundTrackLayout.setVerticalGroup(
            tabCreateSoundTrackLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(tabCreateSoundTrackLayout.createSequentialGroup()
                .addGap(37, 37, 37)
                .addGroup(tabCreateSoundTrackLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblPictureCreateSoundTrack)
                    .addComponent(txtPictureCreateSoundTrack, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btnCleanCreateSoundTrack))
                .addGap(18, 18, 18)
                .addGroup(tabCreateSoundTrackLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(tabCreateSoundTrackLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(lblSongosCreateSoundTrack)
                        .addComponent(btnCreateCreateSoundTrack))
                    .addComponent(btnSongsCreateSoundTrack, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(172, Short.MAX_VALUE))
        );

        tabPanelSoundTrack.addTab("Create", tabCreateSoundTrack);

        txtBuscarDeleteSoundTrack.setForeground(new java.awt.Color(153, 153, 153));
        txtBuscarDeleteSoundTrack.setText("Name.");

        btnBuscarDeleteSoundTrack.setIcon(new javax.swing.ImageIcon(getClass().getResource("/grlu/lupa.gif"))); // NOI18N
        btnBuscarDeleteSoundTrack.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnBuscarDeleteSoundTrackActionPerformed(evt);
            }
        });

        textAreaDeleteMovie2.setColumns(20);
        textAreaDeleteMovie2.setRows(5);
        scrollPanelTextAreaSoundTrack.setViewportView(textAreaDeleteMovie2);

        btnDeleteDeleteSoundTrack.setText("Delete");

        javax.swing.GroupLayout tabDeleteSoundTrackLayout = new javax.swing.GroupLayout(tabDeleteSoundTrack);
        tabDeleteSoundTrack.setLayout(tabDeleteSoundTrackLayout);
        tabDeleteSoundTrackLayout.setHorizontalGroup(
            tabDeleteSoundTrackLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(tabDeleteSoundTrackLayout.createSequentialGroup()
                .addGroup(tabDeleteSoundTrackLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(tabDeleteSoundTrackLayout.createSequentialGroup()
                        .addGap(22, 22, 22)
                        .addComponent(txtBuscarDeleteSoundTrack, javax.swing.GroupLayout.PREFERRED_SIZE, 131, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(btnBuscarDeleteSoundTrack, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(tabDeleteSoundTrackLayout.createSequentialGroup()
                        .addGap(20, 20, 20)
                        .addComponent(scrollPanelTextAreaSoundTrack, javax.swing.GroupLayout.PREFERRED_SIZE, 368, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(50, 50, 50)
                        .addComponent(btnDeleteDeleteSoundTrack, javax.swing.GroupLayout.PREFERRED_SIZE, 107, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(119, Short.MAX_VALUE))
        );
        tabDeleteSoundTrackLayout.setVerticalGroup(
            tabDeleteSoundTrackLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, tabDeleteSoundTrackLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(tabDeleteSoundTrackLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(tabDeleteSoundTrackLayout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addComponent(btnDeleteDeleteSoundTrack))
                    .addGroup(tabDeleteSoundTrackLayout.createSequentialGroup()
                        .addGroup(tabDeleteSoundTrackLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(txtBuscarDeleteSoundTrack)
                            .addComponent(btnBuscarDeleteSoundTrack, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(scrollPanelTextAreaSoundTrack, javax.swing.GroupLayout.DEFAULT_SIZE, 220, Short.MAX_VALUE)))
                .addContainerGap())
        );

        tabPanelSoundTrack.addTab("Delete", tabDeleteSoundTrack);

        javax.swing.GroupLayout soundTrackTabLayout = new javax.swing.GroupLayout(soundTrackTab);
        soundTrackTab.setLayout(soundTrackTabLayout);
        soundTrackTabLayout.setHorizontalGroup(
            soundTrackTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, soundTrackTabLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(tabPanelSoundTrack)
                .addContainerGap())
        );
        soundTrackTabLayout.setVerticalGroup(
            soundTrackTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, soundTrackTabLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(tabPanelSoundTrack, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        tabbedPanelPrincipal.addTab("Sound Track", soundTrackTab);

        lblFindBy.setText("Find By:");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(tabbedPanelPrincipal, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(btnAceptar, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(btnSalir, javax.swing.GroupLayout.PREFERRED_SIZE, 99, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(txtLblBuscar, javax.swing.GroupLayout.PREFERRED_SIZE, 260, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(btnBuscar, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(lblFindBy)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(comboBoxBusqueda, javax.swing.GroupLayout.PREFERRED_SIZE, 87, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGap(0, 0, Short.MAX_VALUE)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(comboBoxBusqueda)
                        .addComponent(lblFindBy))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(7, 7, 7)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(txtLblBuscar)
                            .addComponent(btnBuscar, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))))
                .addGap(18, 18, 18)
                .addComponent(tabbedPanelPrincipal, javax.swing.GroupLayout.PREFERRED_SIZE, 347, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnSalir)
                    .addComponent(btnAceptar))
                .addContainerGap(18, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void btnBuscarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBuscarActionPerformed
        
    }//GEN-LAST:event_btnBuscarActionPerformed

    private void btnBuscarDeletePersonaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBuscarDeletePersonaActionPerformed

        persona = personControl.findPerson(txtBuscarDeletePersona.getText());
        if(persona != null){
            String aux = "";
            aux = aux + "Name: "+ persona.getName() + "\n" +
                "LastName: " + persona.getLastName() + "\n"+
                "BirthDate: " + persona.getBirthDate().toString() + "\n"+
                "BirthPlace: " + persona.getBirthPlace();
            textAreaDeletePersona.setText(aux);
        }
        else{
           JOptionPane.showMessageDialog(frame, "No se encuentra la persona");
        }
    }//GEN-LAST:event_btnBuscarDeletePersonaActionPerformed

    private void btnSeeFindMoviesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSeeFindMoviesActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_btnSeeFindMoviesActionPerformed

    private void btnBuscarDeleteMovieActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBuscarDeleteMovieActionPerformed
        movie = movieControl.findMovie(txtBuscarDeleteMovie.getText());
        if(persona != null){
            String aux = "";
            aux = aux + "Name: "+ movie.getName() + "\n" +
                "Cover: " + movie.getCover() + "\n"+
                "Genre: " + movie.getGenre() + "\n"+
                "Duration: " + movie.getDuration() + "\n"+
                "Director: " + movie.getDirector().getName() + "\n"+
                "Sound Track: " + movie.getSoundTrack().getPicture();
            textAreaDeletePersona.setText(aux);
        }
        else{
           JOptionPane.showMessageDialog(frame, "No se encuentra la Pelicula");
        }        
    }//GEN-LAST:event_btnBuscarDeleteMovieActionPerformed

    private void btnBuscarDeleteSongActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBuscarDeleteSongActionPerformed
        song = songControl.findSong(txtBuscarDeleteSong.getText());
        if(song != null){
            String aux = "";
            aux = aux + "Title: "+ song.getTitle() + "\n" +
                "Duration: " + song.getDuration() + "\n"+
                "Artist: " + song.getArtist().getName() + "\n";
            textAreaDeletePersona.setText(aux);
        }
        else{
           JOptionPane.showMessageDialog(frame, "No se encuentra la cancion");
        }
    }//GEN-LAST:event_btnBuscarDeleteSongActionPerformed
        
    private void btnBuscarDeleteSoundTrackActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBuscarDeleteSoundTrackActionPerformed
        sound = soundControl.findSoundTrack(txtBuscarDeleteSoundTrack.getText());
        if(sound != null){
            String aux = "";
            aux = aux + "Picture: "+ sound.getPicture();
            textAreaDeletePersona.setText(aux);
        }
        else{
           JOptionPane.showMessageDialog(frame, "No se encuentra la cancion");
        }
    }//GEN-LAST:event_btnBuscarDeleteSoundTrackActionPerformed

    private void btnActorsCreateMovieActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnActorsCreateMovieActionPerformed

    }//GEN-LAST:event_btnActorsCreateMovieActionPerformed

    private void btnSongsCreateSoundTrackActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSongsCreateSoundTrackActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_btnSongsCreateSoundTrackActionPerformed

    private void btnSalirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSalirActionPerformed
        System.exit(0);
    }//GEN-LAST:event_btnSalirActionPerformed

    private void btnCleanCreateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCleanCreateActionPerformed
        txtNameCreatePerson.setText("");
        txtLastNameCreatePerson.setText("");
        txtPictureCreatePerson.setText("");
        dateChooserBirth.setDate(null);
        txtBirthPlaceCreatePerson.setText("");        
    }//GEN-LAST:event_btnCleanCreateActionPerformed

    private void btnCleanFindMoviesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCleanFindMoviesActionPerformed
                // TODO add your handling code here:
    }//GEN-LAST:event_btnCleanFindMoviesActionPerformed

    private void btnCreateCreateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCreateCreateActionPerformed
        if(((String)comboBoxJobCreate.getSelectedItem()).equals("Actor")){
               Actor actor = new Actor();
               actor.setName(txtNameCreatePerson.getText());
               actor.setLastName(txtLastNameCreatePerson.getText());
               actor.setPicture(txtPictureCreatePerson.getText());
               actor.setBirthDate(dateChooserBirth.getDate());
               actor.setBirthPlace(txtBirthPlaceCreatePerson.getText());
               int result = personControl.createActor(actor);
               if (result == 0){
                   JOptionPane.showMessageDialog(frame, "El Actor se ha ingresado con exito");
               }
               if (result == 1){
                   JOptionPane.showMessageDialog(frame, "Un Actor con ese Nombre\n ya se encuentra registrado");
               }
               if (result == 2){
                   JOptionPane.showMessageDialog(frame, "Error");
               }
        }
        if(((String)comboBoxJobCreate.getSelectedItem()).equals("Director")){
               Director director = new Director();
               director.setName(txtNameCreatePerson.getText());
               director.setLastName(txtLastNameCreatePerson.getText());
               director.setPicture(txtPictureCreatePerson.getText());
               director.setBirthDate(dateChooserBirth.getDate());
               director.setBirthPlace(txtBirthPlaceCreatePerson.getText());
               int result = personControl.createDirector(director);
               if (result == 0){
                   JOptionPane.showMessageDialog(frame, "El director se ha ingresado con exito");
               }
               if (result == 1){
                   JOptionPane.showMessageDialog(frame, "Un director con ese Nombre\n ya se encuentra registrado");
               }
               if (result == 2){
                   JOptionPane.showMessageDialog(frame, "Error");
               }
        }
        if(((String)comboBoxJobCreate.getSelectedItem()).equals("Artist")){
               Artist artist = new Artist();
               artist.setName(txtNameCreatePerson.getText());
               artist.setLastName(txtLastNameCreatePerson.getText());
               artist.setPicture(txtPictureCreatePerson.getText());
               artist.setBirthDate(dateChooserBirth.getDate());
               artist.setBirthPlace(txtBirthPlaceCreatePerson.getText());
               int result = personControl.createArtist(artist);
               if (result == 0){
                   JOptionPane.showMessageDialog(frame, "El artista se ha ingresado con exito");
               }
               if (result == 1){
                   JOptionPane.showMessageDialog(frame, "Un artista con ese Nombre\n ya se encuentra registrado");
               }
               if (result == 2){
                   JOptionPane.showMessageDialog(frame, "Error");
               }
        }
    }//GEN-LAST:event_btnCreateCreateActionPerformed

    private void txtBuscarDeletePersonaMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_txtBuscarDeletePersonaMouseClicked
        txtBuscarDeletePersona.setText("");
        txtBuscarDeletePersona.setForeground(Color.BLACK);
    }//GEN-LAST:event_txtBuscarDeletePersonaMouseClicked

    private void btnDeleteDeletePersonaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnDeleteDeletePersonaActionPerformed
        if(personControl.deletePerson(persona) == 0){
            JOptionPane.showMessageDialog(frame, "La Persona se ha borrado con exito");
        }else{
            JOptionPane.showMessageDialog(frame, "Error al intentar borrar");
        }
    }//GEN-LAST:event_btnDeleteDeletePersonaActionPerformed

    private void btnCleanCreateMovieActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCleanCreateMovieActionPerformed
        txtNameCreateMovie.setText("");
        txtCoverCreateMovie.setText("");
        jYearChooserMovie.setYear(1970);
        txtKeyWordsCreateMovie.setText("");
        txtGenreCreateMovie.setText("");
        txtDurationCreateMovie.setText("");
        rentalCheckBox.setSelected(false);
        purchaseCheckBox.setSelected(false);
        txtDirectorCreateMovie.setText("");
        txtSoundTrackCreateMovie.setText("");
        jSliderRatingCreateMovie.setValue(0);
    }//GEN-LAST:event_btnCleanCreateMovieActionPerformed

    private void btnCreateCreateMovieActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCreateCreateMovieActionPerformed
        SoundTrack soundTrack = soundControl.findSoundTrack(txtSoundTrackCreateMovie.getText());
        Person director = personControl.findPerson(txtDirectorCreateMovie.getText());
        if(director != null){
            if(soundTrack != null){
                if(durationIsFloat(txtDurationCreateMovie.getText())){
                    Movie movie = new Movie();
                    movie.setName(txtNameCreateMovie.getText());
                    movie.setCover(txtCoverCreateMovie.getText());
                    movie.setYearOfCreation(jYearChooserMovie.getYear());
                    movie.setPlotKeywords(txtKeyWordsCreateMovie.getText());
                    movie.setGenre(txtGenreCreateMovie.getText());
                    movie.setDuration(new Float(txtDurationCreateMovie.getText()));
                    movie.setAvailableForRental(rentalCheckBox.isSelected());
                    movie.setAvailabeForPurchase(purchaseCheckBox.isSelected());
//faltan los actores.
                    movie.setDirector((Director)director);
                    movie.setSoundTrack(soundTrack);
                    movie.setRating((float)(jSliderRatingCreateMovie.getValue()/2));
                }else{
                    JOptionPane.showMessageDialog(frame, "Duracion no valida");
                }
            }else{
                JOptionPane.showMessageDialog(frame, "Sound Track no valido");
            }
        }else{
            JOptionPane.showMessageDialog(frame, "Director invalido");
        }
    }//GEN-LAST:event_btnCreateCreateMovieActionPerformed

    private void btnCleanCreateSongActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCleanCreateSongActionPerformed
        txtTitleCreateSong.setText("");
        txtDurationCreateSong.setText("");
        txtArtistCreateSong.setText("");
    }//GEN-LAST:event_btnCleanCreateSongActionPerformed

    private void btnCreateCreateSongActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCreateCreateSongActionPerformed
        Person artist = personControl.findPerson(txtArtistCreateSong.getText());
        if(artist != null){
            if(durationIsFloat(txtDurationCreateMovie.getText())){
                Song song = new Song();
                song.setTitle(txtTitleCreateSong.getText());
                song.setDuration(new Float(txtDurationCreateSong.getText()));
                song.setArtist((Artist)artist);
            }else{
                JOptionPane.showMessageDialog(frame, "Duracion no valida");
            }
        }else{
            JOptionPane.showMessageDialog(frame, "Artista invalido");
        }
    }//GEN-LAST:event_btnCreateCreateSongActionPerformed

    private void btnEliminarDeleteMovieActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnEliminarDeleteMovieActionPerformed
        if(movieControl.deleteMovie(movie) == 0){
            JOptionPane.showMessageDialog(frame, "La Pelicula se ha borrado con exito");
        }else{
            JOptionPane.showMessageDialog(frame, "Error al intentar borrar");
        }
    }//GEN-LAST:event_btnEliminarDeleteMovieActionPerformed

    private void btnEliminarDeleteSongActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnEliminarDeleteSongActionPerformed
        if(songControl.deleteSong(song) == 0){
            JOptionPane.showMessageDialog(frame, "La Pelicula se ha borrado con exito");
        }else{
            JOptionPane.showMessageDialog(frame, "Error al intentar borrar");
        }
    }//GEN-LAST:event_btnEliminarDeleteSongActionPerformed

    private void btnCleanCreateSoundTrackActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCleanCreateSoundTrackActionPerformed
        txtPictureCreateSoundTrack.setText("");
    }//GEN-LAST:event_btnCleanCreateSoundTrackActionPerformed

    private void btnCreateCreateSoundTrackActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCreateCreateSoundTrackActionPerformed
        SoundTrack sound = new SoundTrack();
        sound.setPicture(txtPictureCreateSoundTrack.getText());
    }//GEN-LAST:event_btnCreateCreateSoundTrackActionPerformed

    private void txtLblBuscarMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_txtLblBuscarMouseClicked
        txtLblBuscar.setText("");
        txtLblBuscar.setForeground(Color.BLACK);
    }//GEN-LAST:event_txtLblBuscarMouseClicked
    
    private boolean durationIsFloat(String numero){
        boolean a = true;
        try{
            Float.parseFloat(numero);
        }catch(NumberFormatException ex){
            a = false;
        }        
        return a;
    }

    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnAceptar;
    private javax.swing.JButton btnActorsCreateMovie;
    private javax.swing.JButton btnBuscar;
    private javax.swing.JButton btnBuscarDeleteMovie;
    private javax.swing.JButton btnBuscarDeletePersona;
    private javax.swing.JButton btnBuscarDeleteSong;
    private javax.swing.JButton btnBuscarDeleteSoundTrack;
    private javax.swing.JButton btnCleanCreate;
    private javax.swing.JButton btnCleanCreateMovie;
    private javax.swing.JButton btnCleanCreateSong;
    private javax.swing.JButton btnCleanCreateSoundTrack;
    private javax.swing.JButton btnCleanFindMovies;
    private javax.swing.JButton btnCreateCreate;
    private javax.swing.JButton btnCreateCreateMovie;
    private javax.swing.JButton btnCreateCreateSong;
    private javax.swing.JButton btnCreateCreateSoundTrack;
    private javax.swing.JButton btnDeleteDeletePersona;
    private javax.swing.JButton btnDeleteDeleteSoundTrack;
    private javax.swing.JButton btnEliminarDeleteMovie;
    private javax.swing.JButton btnEliminarDeleteSong;
    private javax.swing.JButton btnSalir;
    private javax.swing.JButton btnSeeFindMovies;
    private javax.swing.JButton btnSongsCreateSoundTrack;
    private javax.swing.JComboBox comboBoxBusqueda;
    private javax.swing.JComboBox comboBoxJobCreate;
    private com.toedter.calendar.JDateChooser dateChooserBirth;
    private javax.swing.JPanel findMoviesTab;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JSlider jSliderRatingCreateMovie;
    private com.toedter.calendar.JYearChooser jYearChooserMovie;
    private javax.swing.JLabel lblActosrCreateMovie;
    private javax.swing.JLabel lblArtistCreateSong;
    private javax.swing.JLabel lblBirthDateCreatePerson;
    private javax.swing.JLabel lblBirthPlaceCreatePerson;
    private javax.swing.JLabel lblCoverCreateMovie;
    private javax.swing.JLabel lblDirectorCreateMovie;
    private javax.swing.JLabel lblDurationCreateMovie;
    private javax.swing.JLabel lblDurationCreateSong;
    private javax.swing.JLabel lblFindBy;
    private javax.swing.JLabel lblGenreCreateMovie;
    private javax.swing.JLabel lblJobPerson;
    private javax.swing.JLabel lblKeyWordsCreateMovie;
    private javax.swing.JLabel lblLastNameCreatePerson;
    private javax.swing.JLabel lblNameCreateMovie;
    private javax.swing.JLabel lblNombreCreatePerson;
    private javax.swing.JLabel lblPictureCreatePerson;
    private javax.swing.JLabel lblPictureCreateSoundTrack;
    private javax.swing.JLabel lblPurchaseCreateMovie;
    private javax.swing.JLabel lblRatingCreateMovie;
    private javax.swing.JLabel lblRentalCreateMovie;
    private javax.swing.JLabel lblSongosCreateSoundTrack;
    private javax.swing.JLabel lblSoundTrackCreateMovie;
    private javax.swing.JLabel lblTitleCreateSong;
    private javax.swing.JLabel lblYearCreateMovie;
    private javax.swing.JPanel movieTab;
    private javax.swing.JPanel personaTab;
    private javax.swing.JCheckBox purchaseCheckBox;
    private javax.swing.JCheckBox rentalCheckBox;
    private javax.swing.JScrollPane scrollPanelTextArea;
    private javax.swing.JScrollPane scrollPanelTextAreaMovie;
    private javax.swing.JScrollPane scrollPanelTextAreaMovie1;
    private javax.swing.JScrollPane scrollPanelTextAreaSoundTrack;
    private javax.swing.JPanel songTab;
    private javax.swing.JPanel soundTrackTab;
    private javax.swing.JPanel tabCreateMovie;
    private javax.swing.JPanel tabCreatePerson;
    private javax.swing.JPanel tabCreateSong;
    private javax.swing.JPanel tabCreateSoundTrack;
    private javax.swing.JPanel tabDeleteMovie;
    private javax.swing.JPanel tabDeletePerson;
    private javax.swing.JPanel tabDeleteSong;
    private javax.swing.JPanel tabDeleteSoundTrack;
    private javax.swing.JTabbedPane tabPanelMovie;
    private javax.swing.JTabbedPane tabPanelPersona;
    private javax.swing.JTabbedPane tabPanelSong;
    private javax.swing.JTabbedPane tabPanelSoundTrack;
    private javax.swing.JTabbedPane tabbedPanelPrincipal;
    private javax.swing.JTextArea textAreaDeleteMovie;
    private javax.swing.JTextArea textAreaDeleteMovie2;
    private javax.swing.JTextArea textAreaDeletePersona;
    private javax.swing.JTextArea textAreaDeleteSong;
    private javax.swing.JTextField txtArtistCreateSong;
    private javax.swing.JTextField txtBirthPlaceCreatePerson;
    private javax.swing.JTextField txtBuscarDeleteMovie;
    private javax.swing.JTextField txtBuscarDeletePersona;
    private javax.swing.JTextField txtBuscarDeleteSong;
    private javax.swing.JTextField txtBuscarDeleteSoundTrack;
    private javax.swing.JTextField txtCoverCreateMovie;
    private javax.swing.JTextField txtDirectorCreateMovie;
    private javax.swing.JTextField txtDurationCreateMovie;
    private javax.swing.JTextField txtDurationCreateSong;
    private javax.swing.JTextField txtGenreCreateMovie;
    private javax.swing.JTextField txtKeyWordsCreateMovie;
    private javax.swing.JTextField txtLastNameCreatePerson;
    private javax.swing.JTextField txtLblBuscar;
    private javax.swing.JTextField txtNameCreateMovie;
    private javax.swing.JTextField txtNameCreatePerson;
    private javax.swing.JTextField txtPictureCreatePerson;
    private javax.swing.JTextField txtPictureCreateSoundTrack;
    private javax.swing.JTextField txtSoundTrackCreateMovie;
    private javax.swing.JTextField txtTitleCreateSong;
    // End of variables declaration//GEN-END:variables
}
